African countries are known to be underdeveloped when compared to the rest of the world. Due to the countries been underdeveloped, the quality of life in these couuntries are poor. Recently development aid said that the total number of poor people in Africa is about 490 million or about 36% of the whole population in Africa. The happines report done on these countries in Africa will be to compare each countries based on some of the parameters available in the dataset.
Six parameters will be looked at and will be accompanied by visualizations
The parameters are:
We start by loading the libraries to use for the analysis
library(tidyverse)
library(plotly)
Here we load the files to be used. The countries file was loaded beacuse it is necessary for the production of the maps and the data it contains were lacking from the original dataset.
data <- read_csv('C:/Users/ayoro/Desktop/Datasci/Case studies/World happines report/world-happiness-report-2021.csv')
##
## -- Column specification --------------------------------------------------------
## cols(
## .default = col_double(),
## `Country name` = col_character(),
## `Regional indicator` = col_character()
## )
## i Use `spec()` for the full column specifications.
countries <- read_csv('C:/Users/ayoro/Desktop/Datasci/Case studies/World happines report/Countries and code.csv')
##
## -- Column specification --------------------------------------------------------
## cols(
## country = col_character(),
## code = col_character()
## )
We begin exploring the dataset to get an idea of how the columns are structured
## # A tibble: 6 x 20
## `Country name` `Regional indica~ `Ladder score` `Standard error ~ upperwhisker
## <chr> <chr> <dbl> <dbl> <dbl>
## 1 Finland Western Europe 7.84 0.032 7.90
## 2 Denmark Western Europe 7.62 0.035 7.69
## 3 Switzerland Western Europe 7.57 0.036 7.64
## 4 Iceland Western Europe 7.55 0.059 7.67
## 5 Netherlands Western Europe 7.46 0.027 7.52
## 6 Norway Western Europe 7.39 0.035 7.46
## # ... with 15 more variables: lowerwhisker <dbl>, Logged GDP per capita <dbl>,
## # Social support <dbl>, Healthy life expectancy <dbl>,
## # Freedom to make life choices <dbl>, Generosity <dbl>,
## # Perceptions of corruption <dbl>, Ladder score in Dystopia <dbl>,
## # Explained by: Log GDP per capita <dbl>, Explained by: Social support <dbl>,
## # Explained by: Healthy life expectancy <dbl>,
## # Explained by: Freedom to make life choices <dbl>,
## # Explained by: Generosity <dbl>,
## # Explained by: Perceptions of corruption <dbl>, Dystopia + residual <dbl>
## Rows: 149
## Columns: 20
## $ `Country name` <chr> "Finland", "Denmark", "Sw~
## $ `Regional indicator` <chr> "Western Europe", "Wester~
## $ `Ladder score` <dbl> 7.842, 7.620, 7.571, 7.55~
## $ `Standard error of ladder score` <dbl> 0.032, 0.035, 0.036, 0.05~
## $ upperwhisker <dbl> 7.904, 7.687, 7.643, 7.67~
## $ lowerwhisker <dbl> 7.780, 7.552, 7.500, 7.43~
## $ `Logged GDP per capita` <dbl> 10.775, 10.933, 11.117, 1~
## $ `Social support` <dbl> 0.954, 0.954, 0.942, 0.98~
## $ `Healthy life expectancy` <dbl> 72.000, 72.700, 74.400, 7~
## $ `Freedom to make life choices` <dbl> 0.949, 0.946, 0.919, 0.95~
## $ Generosity <dbl> -0.098, 0.030, 0.025, 0.1~
## $ `Perceptions of corruption` <dbl> 0.186, 0.179, 0.292, 0.67~
## $ `Ladder score in Dystopia` <dbl> 2.43, 2.43, 2.43, 2.43, 2~
## $ `Explained by: Log GDP per capita` <dbl> 1.446, 1.502, 1.566, 1.48~
## $ `Explained by: Social support` <dbl> 1.106, 1.108, 1.079, 1.17~
## $ `Explained by: Healthy life expectancy` <dbl> 0.741, 0.763, 0.816, 0.77~
## $ `Explained by: Freedom to make life choices` <dbl> 0.691, 0.686, 0.653, 0.69~
## $ `Explained by: Generosity` <dbl> 0.124, 0.208, 0.204, 0.29~
## $ `Explained by: Perceptions of corruption` <dbl> 0.481, 0.485, 0.413, 0.17~
## $ `Dystopia + residual` <dbl> 3.253, 2.868, 2.839, 2.96~
From the information we have above, we will be dropping columns that will not be used in the analysis
There are seven continents in the world, but the countries in the dataset have been divided into regions. All the regions present in the data are present below.
## # A tibble: 10 x 1
## `Regional indicator`
## <chr>
## 1 Western Europe
## 2 North America and ANZ
## 3 Middle East and North Africa
## 4 Latin America and Caribbean
## 5 Central and Eastern Europe
## 6 East Asia
## 7 Southeast Asia
## 8 Commonwealth of Independent States
## 9 Sub-Saharan Africa
## 10 South Asia
The names of the colums were changed from the original to better fit the analysis
The next step done was to join the codes present in the countries table to the data that we already have. Inner join was used to combine this information.
Since we are looking at african countries only, we select for any country that has Sub-Saharan Africa has its region
## # A tibble: 33 x 9
## country region gdp_per_capita social_support life_expectancy freedom
## <chr> <chr> <dbl> <dbl> <dbl> <dbl>
## 1 Mauritius Sub-Saharan~ 10.0 0.905 66.7 0.867
## 2 Cameroon Sub-Saharan~ 8.19 0.71 53.5 0.731
## 3 Senegal Sub-Saharan~ 8.12 0.71 59.8 0.695
## 4 Ghana Sub-Saharan~ 8.58 0.727 57.6 0.807
## 5 Niger Sub-Saharan~ 7.10 0.641 53.8 0.806
## 6 Benin Sub-Saharan~ 8.09 0.489 54.7 0.757
## 7 Guinea Sub-Saharan~ 7.84 0.639 55.0 0.697
## 8 South Afr~ Sub-Saharan~ 9.40 0.86 56.9 0.749
## 9 Gabon Sub-Saharan~ 9.60 0.776 60.0 0.731
## 10 Burkina F~ Sub-Saharan~ 7.68 0.672 54.2 0.695
## # ... with 23 more rows, and 3 more variables: generosity <dbl>,
## # corruption <dbl>, code <chr>
The african countries present were filtered for first and the result does not contian all information about the 56 african countries To progress further, the column containing Middle East and North African countries was checked for presence of african countries
## # A tibble: 16 x 9
## country region gdp_per_capita social_support life_expectancy freedom
## <chr> <chr> <dbl> <dbl> <dbl> <dbl>
## 1 Israel Middle Eas~ 10.6 0.939 73.5 0.8
## 2 Bahrain Middle Eas~ 10.7 0.862 69.5 0.925
## 3 United Ara~ Middle Eas~ 11.1 0.844 67.3 0.932
## 4 Saudi Arab~ Middle Eas~ 10.7 0.891 66.6 0.877
## 5 Kuwait Middle Eas~ 10.8 0.843 66.9 0.867
## 6 Libya Middle Eas~ 9.62 0.827 62.3 0.771
## 7 Turkey Middle Eas~ 10.2 0.822 67.2 0.576
## 8 Morocco Middle Eas~ 8.90 0.56 66.2 0.774
## 9 Algeria Middle Eas~ 9.34 0.802 66.0 0.48
## 10 Iraq Middle Eas~ 9.24 0.746 60.6 0.63
## 11 Iran Middle Eas~ 9.58 0.71 66.3 0.608
## 12 Tunisia Middle Eas~ 9.27 0.691 67.2 0.656
## 13 Lebanon Middle Eas~ 9.63 0.848 67.4 0.525
## 14 Jordan Middle Eas~ 9.18 0.767 67 0.755
## 15 Egypt Middle Eas~ 9.37 0.75 62.0 0.749
## 16 Yemen Middle Eas~ 7.58 0.832 57.1 0.602
## # ... with 3 more variables: generosity <dbl>, corruption <dbl>, code <chr>
From the result above, there are some african countries present in column and the regional classification of these countries was changed.
Now we should have all african countries in the data set classisified with the Sub-Saharan Africa classification
## # A tibble: 38 x 9
## country region gdp_per_capita social_support life_expectancy freedom
## <chr> <chr> <dbl> <dbl> <dbl> <dbl>
## 1 Mauritius Sub-Saharan~ 10.0 0.905 66.7 0.867
## 2 Libya Sub-Saharan~ 9.62 0.827 62.3 0.771
## 3 Cameroon Sub-Saharan~ 8.19 0.71 53.5 0.731
## 4 Senegal Sub-Saharan~ 8.12 0.71 59.8 0.695
## 5 Ghana Sub-Saharan~ 8.58 0.727 57.6 0.807
## 6 Niger Sub-Saharan~ 7.10 0.641 53.8 0.806
## 7 Benin Sub-Saharan~ 8.09 0.489 54.7 0.757
## 8 Guinea Sub-Saharan~ 7.84 0.639 55.0 0.697
## 9 South Afr~ Sub-Saharan~ 9.40 0.86 56.9 0.749
## 10 Morocco Sub-Saharan~ 8.90 0.56 66.2 0.774
## # ... with 28 more rows, and 3 more variables: generosity <dbl>,
## # corruption <dbl>, code <chr>
Following the change of the countries, it was observed that the dataset does not contain all the african countries. This is a limitation in our analysis as it will not represent the whole of the continent.
The Sub-Saharan Africa name was changed to Africa and the Middle East and North Africa name was changed to ‘Middle East’
Getting a view of how many countries per region
This is where we begin the analysis of the data. We will perform analysis based on each african countries and the african region when compared to the other regions.
The map below shows the gdp per capita of each of the african countries present. Countries with a white colour in the map are left blank due to lack of information about them.
Then we take a look at the top countries in Africa with the highest and lowest gdp_per_capita
Top 5 countries with the highest gdp per capita
## # A tibble: 5 x 1
## country
## <chr>
## 1 Mauritius
## 2 Botswana
## 3 Libya
## 4 Gabon
## 5 South Africa
Countries with the lowest gdp per capita in africa
## # A tibble: 5 x 1
## country
## <chr>
## 1 Liberia
## 2 Mozambique
## 3 Niger
## 4 Malawi
## 5 Burundi
Life expectancy is a statistical measure of the average time an organism is expected to live, based on the year of its birth, its current age, and other demographic factors including biological sex. The life expectancy of the african countries are illustrated below
The top 5 african countries with the highest life expectancy
## # A tibble: 5 x 1
## country
## <chr>
## 1 Tunisia
## 2 Mauritius
## 3 Morocco
## 4 Algeria
## 5 Libya
The buttom 5 countries in Africa with the least life expectancy
## # A tibble: 5 x 1
## country
## <chr>
## 1 Chad
## 2 Lesotho
## 3 Nigeria
## 4 Swaziland
## 5 Sierra Leone
Freedom, generally, is having the ability to act or change without constraint. The map below shows the freedom level experienced by the citizens of each country in Africa
The top 5 countries in Africa with the highest freedom ratings are
## # A tibble: 5 x 1
## country
## <chr>
## 1 Rwanda
## 2 Mozambique
## 3 Mauritius
## 4 Tanzania
## 5 Botswana
The buttom 5 countries in Africa with the least freedom are
## # A tibble: 5 x 1
## country
## <chr>
## 1 Algeria
## 2 Comoros
## 3 Madagascar
## 4 Mauritania
## 5 Chad
Corruption, as defined by the World Bank, is a form of dishonesty or criminal offense undertaken by a person or organization entrusted with a position of authority, to acquire illicit benefit or abuse power for private gain. African countries are particularly known to have corrupt leaders which can be associated with the mis-management of public funds and eventually under development
The map below is that of how african countries compare to one another in terms of corruption
The 5 most corrupt countries in Africa are listed below
## # A tibble: 5 x 1
## country
## <chr>
## 1 Lesotho
## 2 Nigeria
## 3 Tunisia
## 4 Sierra Leone
## 5 South Africa
The least corrupt companies are listed below
## # A tibble: 5 x 1
## country
## <chr>
## 1 Algeria
## 2 Comoros
## 3 Madagascar
## 4 Mauritania
## 5 Chad
Generosity is the virtue of being liberal in giving, often as gifts. Generosity is regarded as a virtue by various world religions, and is often celebrated in cultural and religious ceremonies.
We take a look at how the citizens of these african countries compare to one another in terms of their generosity
The 5 most generous countries in Africa are listed below
## # A tibble: 5 x 1
## country
## <chr>
## 1 Kenya
## 2 Tanzania
## 3 Ghana
## 4 Uganda
## 5 Guinea
The least generous companies are listed below
## # A tibble: 5 x 1
## country
## <chr>
## 1 Botswana
## 2 Morocco
## 3 Tunisia
## 4 Gabon
## 5 Swaziland
From the results obtained from the different parameters, this analysis has allowed us to compare how different african countries rank between eachother. The limit to this analysis is that the dataset dosen’t contain data for all african countries. Thus, this analysis is not a complete one as it dose not represent all of the countries. Nevertheless, we were still able to get some insight from the available data.
Social support
Social support means having friends and other people, including family, to turn to in times of need or crisis to give you a broader focus and positive self-image. Here we look at how each of these african countries compare to each other in terms of social support.
Now we check the countries in the top and button 5 in terms of social support
Top 5 countries in social support
Countries with the least social support